<template>
	<view>
		<view class="card" v-for="(item, index) in tableList" :key="index">
			<view class="text-container">
				<view>
					<h3>{{  }}</h3>
				</view>
				<view>
					<p>4小时前</p>
				</view>
			</view>
			<view class="image-container">
				<img style="width: 200rpx; height: 200rpx; object-fit: contain"
					src="../../static/images/banner/banner01.jpg" alt="Construction" />
			</view>
		</view>
		<view>
			<u-loadmore @loadmore="loadmore" :status="status" />
		</view>
	</view>
</template>

<script>
	import {
		safeThreeOnelist
	} from '@/api/article/index'
	export default {
		data() {
			return {
				status: "loadmore",
				tableList: [],
				size: 5,
				current: 0
			};
		},
		onLoad() {
			this.loadmore();
			
		},
		mounted() {
			this.list();
		},
		methods: {
			async list() {
				const {
					rows,
					code,
					msg
				} = await safeThreeOnelist({
					current: this.current,
					size: this.size
				});
				if (code == 200) {
					// 将新加载的数据追加到现有的 tableList 中
					this.tableList = this.tableList.concat(rows);
				}
			},
			loadmore() {
				this.current++;
				this.list();
				this.status = "nomore";
			},
		},
	};
</script>

<style lang="scss">
	.card {
		display: flex;
		border: 1px solid #ddd;
		border-radius: 8px;
		overflow: hidden;
		height: 200rpx;
	}

	.image-container {
		flex: 1;
	}

	.image-container img {
		width: 100%;
		height: auto;
		border-radius: 50rpx 50rpx;
		/* 圆角效果 */
	}

	.text-container {
		flex: 2;
		padding: 10px;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}

	.text-container h3 {
		margin: 0;
		font-size: 30rpx;
	}

	.text-container p {
		color: #888;
		font-size: 14px;
	}
</style>